var incomeAdd = {
    add: function(url_data, chart)
    {
        $("#incomeForm").submit(function() {
            var url = $("#incomeForm").attr("action");
            $('#add-income').text('Adding ...');
            
            $.post(url,
                $("#incomeForm").serialize(),
                function(data) {
                    if (data.status) {
                        $('#flash-alert').append("<div class='alert alert-success' role='alert'>Expense added!</div>");
                        $('#flash-alert div').fadeOut(4000, function() {
                        });
                        var dateTo   = $('#select-month-to').val(); 
                        var dateFrom = $('#select-month-from').val(); 
                        $('#list').jqGrid('setGridParam',{ postData:{ 'date_to': dateTo, 'date_from': dateFrom }, search:true });
                        $('#list').trigger("reloadGrid");
                        chart.refresh('chart1', url_data);
                        $('#income_amount').val('');
                        $('#income_comment').val('');
                        $('#income_date_created').val(moment().format('DD.MM.YYYY'));
                    } else {
                        $('#flash-alert').append("<div class='alert alert-danger' role='alert'>Expense not added!</div>");
                        $('#flash-alert div').fadeOut(4000, function() {
                        });
                    }
                    $('#add-income').text('Add Income');
                }
            );

            return false;
        });
    }
}
